﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ChallengePuzzle.Lib
{
    /// <summary>
    /// 判断类，判断该数是否是幸运数
    /// </summary>
    public class Judger
    {
        
        IPlusSum         PlusSum = new PlusSum();
        SquareSum     SquareSum = new SquareSum();
        Prime             Prime = new Prime();
        /// <summary>
        /// 判断该数是否是幸运数
        /// </summary>
        /// <param name="JudgeNumber">要判断的数</param>
        /// <returns>返回值说明：true 是幸运数，false 不是幸运数</returns>
        public bool IsLuckyNumber(int JudgeNumber)
        {

           // int[] posNumbers = SplitNumber.SplitNumberToArray(JudgeNumber);

            int plusSum = PlusSum.GetPlusSum(JudgeNumber);

            if (!Prime.IsPrime(plusSum)) return false;

            int squareSum = SquareSum.GetSquareSum(JudgeNumber);

            if (!Prime.IsPrime(squareSum)) return false;

            return true;
        }


    }


}
